package com.design.movieticket.common.util;

import java.util.Random;

public class RandomTicketNum {
    private static Random random = new Random();

    public static String createTicketNum(){
        String strT = "T";
        for(int i = 0; i<9 ; i++){
            String string = random.nextInt( 2 ) % 2 == 0 ? "num" : "char";
            if ("char".equals(string)){
                strT += (char) (97 + random.nextInt( 26 ));
            }
            else if ("num".equalsIgnoreCase(string)){
                strT += String.valueOf( random.nextInt(10) );
            }
        }
        return strT;
    }

    public static String createCinemaNum(){
        String strC = "C";
        for(int i = 0; i<6 ; i++){
            String string = random.nextInt( 2 ) % 2 == 0 ? "num" : "char";
            strC += String.valueOf( random.nextInt(10) );
        }
        return strC;
    }
}
